﻿using System;

namespace ProjectEuler.Sudoku
{
    public sealed class SudokuNode
    {
        private Int32 _value;
        private Boolean _fixed;

        private Int32 _column;
        private Int32 _region;
        private Int32 _row;

        public SudokuNode(Int32 row, Int32 column, Int32 region)
        {
            _column = column;
            _region = region;
            _row = row;
        }

        public SudokuNode(Int32 value, Boolean isFixed, Int32 row, Int32 column, Int32 region)
            : this(row, column, region)
        {
            _value = value;
            _fixed = isFixed;
        }

        public Int32 Value
        {
            get { return _value; }
            set
            {
                if (_fixed)
                {
                    throw new InvalidOperationException();
                }

                _value = value;
            }
        }

        public Boolean IsFixed
        {
            get { return _fixed; }
        }

        public Int32 Row
        {
            get { return _row; }
        }

        public Int32 Region
        {
            get { return _region; }
        }

        public Int32 Column
        {
            get { return _column; }
        }
    }
}
